package ${package.Controller};


import com.bbgz.api.base.BaseController;
import com.bbgz.common.base.domain.BaseOperationVO;
import com.bbgz.common.annotion.Operation;
import com.bbgz.common.base.JsonResponse;
import com.bbgz.common.enums.ActionType;
import com.bbgz.common.enums.BusType;
import com.bbgz.util.CodeKit;
import ${cfg.voPackage}.${entity}VO;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import ${package.Service}.${entity}Service;
import javax.annotation.Resource;

/**
 *
 * @author ${author}
 * @since ${date}
 */
@RestController
public class ${table.controllerName} extends  BaseController{

    @Resource
    private ${entity}Service ${entity?uncap_first}Service;


    @Operation(actType = ActionType.DELETE,busType = BusType.${cfg.operationType}, getValue = "${cfg.className}")
    @RequestMapping(value = "/tms/${entity?uncap_first}/delete",method = RequestMethod.POST)
    public JsonResponse deleteById(@RequestBody ${entity}VO vo){
        vo.setDeleteBy(adminShiroUtils.getUserCode());
        return JsonResponse.getSuccessResponse("删除成功").setData(${entity?uncap_first}Service.removeById(vo));
    }

    @Operation(actType = ActionType.INSERT,busType = BusType.${cfg.operationType}, getValue = "${cfg.className}")
    @RequestMapping(value = "/tms/${entity?uncap_first}/insert",method = RequestMethod.POST)
    public JsonResponse insert(@RequestBody ${entity}VO vo){
        //如果需要统一生成的code  需要在此处 放进vo

        return JsonResponse.getSuccessResponse("添加成功").setData(${entity?uncap_first}Service.insert(vo));
    }

    @Operation(actType = ActionType.UPDATE,busType = BusType.${cfg.operationType}, getValue = "${cfg.className}")
    @RequestMapping(value = "/tms/${entity?uncap_first}/update",method = RequestMethod.POST)
    public JsonResponse update(@RequestBody ${entity}VO vo){
        return JsonResponse.getSuccessResponse("修改成功").setData(${entity?uncap_first}Service.updateById(vo));
    }

    @RequestMapping(value = "/tms/${entity?uncap_first}/plist",method = RequestMethod.POST)
    public JsonResponse pageList(@RequestBody ${entity}VO vo){
        return JsonResponse.getSuccessResponse("查询成功").setData(${entity?uncap_first}Service.pageList(vo));
    }

    @RequestMapping(value = "/tms/${entity?uncap_first}/list",method = RequestMethod.POST)
    public JsonResponse list(@RequestBody ${entity}VO vo){
        return JsonResponse.getSuccessResponse("查询成功").setData(${entity?uncap_first}Service.listNoPage(vo));
    }

    @RequestMapping(value = "/tms/${entity?uncap_first}/selectById",method = RequestMethod.POST)
    public JsonResponse selectById(@RequestBody ${entity}VO vo){
        return JsonResponse.getSuccessResponse("查询成功").setData(${entity?uncap_first}Service.selectById(vo));
    }

    @RequestMapping(value = "/tms/${entity?uncap_first}/operation",method = RequestMethod.POST)
    public JsonResponse operation(@RequestBody ${entity}VO vo){
        vo.setBusType(BusType.${cfg.operationType}.getCode());
        return JsonResponse.getSuccessResponse("查询成功").setData(${entity?uncap_first}Service.operationList(vo));
    }

    @RequestMapping(value = "/tms/${entity?uncap_first}/operation/detail",method = RequestMethod.POST)
    public JsonResponse operationDetail(@RequestBody BaseOperationVO vo){
        return JsonResponse.getSuccessResponse("查询成功").setData(${entity?uncap_first}Service.operationDetail(vo));
    }
}
